import React, { useContext, useEffect, useState } from 'react';
import WsPlayer from '../../../../../../../WsPlayer';
import FetchHelper from '../../../../../../../utils/helper/fetch-helper';
import '../VideoMonitor.css';

export default function WsPlayerInstance() {

    const [boFangDiZhi, setboFangDiZhi] = useState(null);

    useEffect(()=>{
        FetchHelper.getJson(`/admin-api/ybyj/sp/rtspRealtimePreview`).then(resp => {
            console.log('222', resp, resp.data?.channelCode, resp.data?.urls?.[0], resp.data?.wsUrL)
            setboFangDiZhi({ rURL: resp.data?.urls?.[0], wURL: resp.data?.wsUrL, cId: resp.data?.channelCode })
            console.log('333', a)

        })

    },[])


    return (
        <WsPlayer
            playParams={{
                rtspURL: boFangDiZhi?.rURL,
                wsURL: boFangDiZhi?.wURL,
                channelId: boFangDiZhi?.cId
            }}
            width={800}
            height={590} // 调整为与视频监视器内容区域高度相同
        />
    );
}